﻿using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Shared.Loggers
{    
    public class NLogAdapter : ILogger
    {
        private readonly Logger _log;     

        public NLogAdapter()
        {            
            _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString());            
        }

        public void Log(string message)
        {
            _log.Info(message);
        }

        public void Log(string message, Exception ex, out Guid ticket)
        {
            ticket = Guid.NewGuid();            
            _log.Error(ex, message);            
        }

        public void Log(Exception ex, out Guid ticket)
        {
            Log(ex.Message, ex, out ticket);
        }

        public void Log(string message, Exception ex)
        {
            _log.Error(ex, message);
        }

        public void Log(Exception ex)
        {
            Log(ex.Message, ex);
        }
    }
}
